package com.groupbuying.customer.service.impl;

import com.groupbuying.customer.connector.SysconfigFeign;
import com.groupbuying.customer.constants.CommonConstants;
import com.groupbuying.customer.utils.JSONUtils;
import com.groupbuying.customer.utils.apiresult.ApiResultCode;
import com.groupbuying.customer.utils.ReturnUtils;
import com.groupbuying.customer.dao.CustomerAccountDao;
import com.groupbuying.customer.domain.CustomerAccountDO;
import com.groupbuying.customer.service.CustomerAccountService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;



@Service
public class CustomerAccountServiceImpl implements CustomerAccountService {
	@Autowired
	private CustomerAccountDao customerAccountDao;

	@Override
	public CustomerAccountDO get(String uuid){
		return customerAccountDao.get(uuid);
	}
	
	@Override
	public List<CustomerAccountDO> list(Map<String, Object> map){
		return customerAccountDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return customerAccountDao.count(map);
	}
	
	@Override
	public int save(CustomerAccountDO account){
		return customerAccountDao.save(account);
	}
	
	@Override
	public int update(CustomerAccountDO account){
		return customerAccountDao.update(account);
	}
	
	@Override
	public int remove(String uuid){
		return customerAccountDao.remove(uuid);
	}
	
	@Override
	public int batchRemove(String[] uuids){
		return customerAccountDao.batchRemove(uuids);
	}


	@Override
	public CustomerAccountDO getByCustomerUuid(String uuid) {
		Map map = new HashMap();
		map.put("customeruuid", uuid);
		map.put("delflag", "1");
		List<CustomerAccountDO> list = customerAccountDao.list(map);
		return list != null && list.size() > 0 ? list.get(0) : null;
	}
}
